package ovm.entity;

import javax.persistence.*;
import java.util.Collection;

@Table(name = "MENU", schema = "DBO_DIPLOM_NEW", catalog = "")
@Entity
public class MenuEntity {

    private int id;

    @Column(name = "ID")
    @Id
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    private String caption;

    @Column(name = "CAPTION")
    @Basic
    public String getCaption() {
        return caption;
    }

    public void setCaption(String caption) {
        this.caption = caption;
    }

    private String actionClass;

    @Column(name = "ACTION_CLASS")
    @Basic
    public String getActionClass() {
        return actionClass;
    }

    public void setActionClass(String actionClass) {
        this.actionClass = actionClass;
    }

    private int parentId;

    @Column(name = "PARENT_ID")
    @Basic
    public int getParentId() {
        return parentId;
    }

    public void setParentId(int parentId) {
        this.parentId = parentId;
    }

    private int orderNumber;

    @Column(name = "ORDER_NUMBER")
    @Basic
    public int getOrderNumber() {
        return orderNumber;
    }

    public void setOrderNumber(int orderNumber) {
        this.orderNumber = orderNumber;
    }

    private int rule;

    @Column(name = "RULE")
    @Basic
    public int getRule() {
        return rule;
    }

    public void setRule(int rule) {
        this.rule = rule;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        MenuEntity that = (MenuEntity) o;

        if (id != that.id) return false;
        if (orderNumber != that.orderNumber) return false;
        if (parentId != that.parentId) return false;
        if (rule != that.rule) return false;
        if (actionClass != null ? !actionClass.equals(that.actionClass) : that.actionClass != null) return false;
        if (caption != null ? !caption.equals(that.caption) : that.caption != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (caption != null ? caption.hashCode() : 0);
        result = 31 * result + (actionClass != null ? actionClass.hashCode() : 0);
        result = 31 * result + parentId;
        result = 31 * result + orderNumber;
        result = 31 * result + rule;
        return result;
    }
}
